// Learn TypeScript:
//  - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html

import FSMState from "./FSMState";


export default class FSMManager  {
    // 状态列表
    stateList: FSMState[] = [];
    // 当前状态ID
    currentID: number = -1;

    // 改变状态
    changeState(stateID: number) {
        this.currentID = stateID;
        // 调用新状态id的enter方法
        this.stateList[this.currentID].OnEnter();
    }

    // 更新调用
    OnUpdate() {
        if (this.currentID != -1) {
            this.stateList[this.currentID].OnUpdate();
        }
    }
}
